<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录界面</title>
    <link rel="stylesheet" href="../css/layui.css">
    <style>
        body {
            background-color: #e9efff;
            background-size: cover; /* 背景图片自适应填充整个页面 */
            background-position: center; /* 图片居中 */
            background-repeat: no-repeat; /* 不重复背景图片 */
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
        }

        .container {
            display: flex; /* 使用flex布局 */
            justify-content: center; /* 居中显示 */
            align-items: center;
        }

        .image-container {
            background-image: url('../images/shopping/admin.png'); /* 设置背景图片的路径 */
            background-size: cover;
            padding: 200px;
            width: 100px;
            border-radius: 10px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            text-align: center;
        }

        .login-container {
            background-color: white;
            padding: 50px;
            width: 360px;
            border-radius: 10px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            text-align: center;
        }

        .login-container h2 {
            margin-bottom: 30px;
        }

        .login-container .layui-form-item {
            margin-bottom: 20px;
        }

        /* 修改Sign In按钮为黑色 */
        .login-container .layui-btn-blue {
            background-color: #1E9FFF;  /* 设置背景颜色为蓝色 */
            color: white;  /* 设置文字颜色为白色 */
            border: none; /* 去掉边框 */
        }

        .login-container .layui-btn-blue:hover {
            background-color: #0069D9;  /* 悬停时的颜色 */
        }
        .login-container .layui-btn {
            width: 100%;
        }

        .login-container .other-login {
            margin-top: 20px;
            display: flex;
            align-items: center;
        }

        .login-container .other-login hr {
            flex-grow: 1;
            border: none;
            border-top: 1px solid #ddd;
        }

        .login-container .other-login span {
            margin: 0 10px;
            color: #999;
        }

        .login-container .footer {
            margin-top: 20px;
            color: #666;
            font-size: 12px;
        }

        .login-container .footer a {
            color: #1E9FFF;
        }
    </style>
</head>
<body>
<div class="container">
    <div class="image-container"></div>
    <div class="login-container">
        <h2>BUMA store Manager</h2>
        <form class="layui-form">
            <div class="layui-form-item">
                <input type="text" name="username" required lay-verify="required" placeholder="管理员账号" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-item">
                <input type="password" name="password" required lay-verify="required" placeholder="密码" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-item">
                <button class="layui-btn layui-btn-black" lay-submit>登录</button>
            </div>
            <div class="other-login">
                <hr><span>or</span><hr>
            </div>

        </form>
        <div class="footer">
            <a href="#">Forgot password?</a><br>
        </div>

    </div>
</div>
<script src="../js/layui.js"></script>
<script>
    layui.use(['form', 'layer'], function(){
        var form = layui.form,
            layer = layui.layer;

        // 监听登录提交事件
        form.on('submit', function(data){
            var username = data.field.username;
            var password = data.field.password;

            // 模拟用户名和密码
            if(username === 'admin' && password === 'admin123'){
                layer.msg('登录成功，正在跳转...');
                setTimeout(function(){
                    window.location.href = 'shopping.jsp'; // 登录成功后跳转的页面
                }, 1000);
            } else {
                layer.msg('用户名或密码错误');
            }
            return false;
        });
    });

</script>
</body>
</html>
